﻿using SqlSugar;

namespace VueAdminService.DTO
{
	[SugarTable("Permission")]
	public class PermissionDTO
	{
		/// <summary>
		/// 权限Id
		/// </summary>
		[SugarColumn(IsPrimaryKey = true)]
		public string PermissionId { get; set; }
		/// <summary>
		/// 权限名
		/// </summary>
		public string PermissionName { get; set; }
		/// <summary>
		/// 权限代码
		/// </summary>
		public string PermissionCode { get; set; }
		/// <summary>
		/// 权限url
		/// </summary>
		public string? Url { get; set; }
		/// <summary>
		/// 图标（适用于菜单）
		/// </summary>
		public string? Icon { get; set; }
		/// <summary>
		/// 排序号，适用于菜单
		/// </summary>
		public int? Order { get; set; }
		/// <summary>
		/// 权限类型   menu或operator
		/// </summary>
		public string Type { get; set; } = "menu";
		/// <summary>
		/// 上级权限id
		/// </summary>
		public string? ParentId { get; set; }
		/// <summary>
		/// 子权限
		/// </summary>
		[SugarColumn(IsIgnore = true)]
		public List<PermissionDTO> Children { get; set; } = new List<PermissionDTO>();
		/// <summary>
		/// 是否有子权限
		/// </summary>
		[SugarColumn(IsIgnore = true)]
		public bool HasChildren { get { return Children.Count > 0; } }
	}
}
